package org.dochandler.dao.derby;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;

import org.dochandler.config.DHConfig;
import org.dochandler.dao.MissionReportDAO;
import org.dochandler.service.domain.mission.MissionReport;
import org.dochandler.service.exception.DatabaseException;

@SuppressWarnings("serial")
public class DerbyMissionReportDAO implements MissionReportDAO, Serializable {
	
	private Connection conn;
	private String derbyUrl;
	private String derbyDriver;
	
	public DerbyMissionReportDAO() {
		if (conn == null) {
			this.derbyUrl = DHConfig.getString("local_db_url");
			this.derbyDriver = DHConfig.getString("local_db_driver");
	
			try {
				Class.forName(derbyDriver).newInstance();
				conn = DriverManager.getConnection(derbyUrl);
			} catch (Exception e) {
				throw new DatabaseException("Could not connect to the database", e);
			}
		}
	}
	
	@Override
	public MissionReport findById(Long entityId) {
		return null;
	}

	@Override
	public List<MissionReport> findAll() {
		List<MissionReport> reports = new ArrayList<MissionReport>();
		return reports;
	}

	@Override
	public boolean create(MissionReport entity) {
		return true;
	}

	@Override
	public boolean delete(Long approvalId) {
		return false;
	}

	@Override
	public boolean update(MissionReport missionReport) {
		return false;
	}

	@Override
	public Long report(MissionReport missionReport) {
		return null;
	}
	
}